package com.gxuwz.eschool;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
//首页-全部
public class AllApplicationActivity extends AppCompatActivity {
    private TextView tv_new_announcement;
    private TextView tv_school_introduction;
    private TextView tv_water_records;
    private TextView tv_payment;
    private TextView tv_card_recharge;
    private TextView tv_change_password;
    private TextView tv_detailed;
    private TextView tv_bathe;
    private TextView tv_card_loss_report;
    private TextView tv_card_unlocking;
    private TextView tv_balance;
    private TextView tv_utility_bill_payment;
    private TextView tv_water_recharge;
    private ImageView iv_back;
    private TextView tv_bookkeeping;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_all_application);
        tv_new_announcement = findViewById(R.id.tv_new_announcement);
        tv_school_introduction = findViewById(R.id.tv_school_introduction);
        tv_water_records = findViewById(R.id.tv_water_records);
        tv_payment = findViewById(R.id.tv_payment);
        tv_card_recharge = findViewById(R.id.tv_card_recharge);
        tv_change_password = findViewById(R.id.tv_change_password);
        tv_detailed = findViewById(R.id.tv_detailed);
        tv_bathe = findViewById(R.id.tv_bathe);
        tv_card_loss_report = findViewById(R.id.tv_card_loss_report);
        tv_card_unlocking = findViewById(R.id.tv_card_unlocking);
        tv_balance = findViewById(R.id.tv_balance);
        tv_utility_bill_payment = findViewById(R.id.tv_utility_bill_payment);
        tv_water_recharge = findViewById(R.id.tv_water_recharge);
        tv_bookkeeping = findViewById(R.id.tv_bookkeeping);

        iv_back = findViewById(R.id.iv_back);
        iv_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                // 使用SupportFragmentManager来管理Fragment事务
                FragmentManager fragmentManager = getSupportFragmentManager();

                // 检查是否有Fragment可以回退
                if (fragmentManager.getBackStackEntryCount() > 0) {
                    fragmentManager.popBackStack(); // 返回上一个Fragment
                } else {
                    // 如果没有Fragment可以回退，结束当前Activity
                    finish();
                }
            }
        });


        tv_payment.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(AllApplicationActivity.this, PaymentActivity.class);
                startActivity(intent);
            }
        });

        tv_school_introduction.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(AllApplicationActivity.this, SchoolIntroductionActivity.class);
                startActivity(intent);
            }
        });
        tv_card_recharge.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(AllApplicationActivity.this, CardRechargeActivity.class);
                startActivity(intent);
            }
        });

        tv_detailed.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(AllApplicationActivity.this, DetailedQueryActivity.class);
                startActivity(intent);
            }
        });

        tv_card_loss_report.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(AllApplicationActivity.this, CardLossReportActivity.class);
                startActivity(intent);
            }
        });
        tv_card_unlocking.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(AllApplicationActivity.this, CardUnlockingActivity.class);
                startActivity(intent);
            }
        });
        tv_utility_bill_payment.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(AllApplicationActivity.this, UtilityBillPaymentActivity.class);
                startActivity(intent);
            }
        });
        tv_bathe.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(AllApplicationActivity.this, BatheActivity.class);
                startActivity(intent);
            }
        });

        tv_new_announcement.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(AllApplicationActivity.this, NewAnnouncementActivity.class);
                startActivity(intent);
            }
        });
        tv_water_records.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(AllApplicationActivity.this, WaterRecordActivity.class);
                startActivity(intent);
            }
        });
        tv_water_recharge.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(AllApplicationActivity.this, WaterRechargeActivity.class);
                startActivity(intent);
            }
        });
        tv_change_password.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(AllApplicationActivity.this, ChangePasswordActivity.class);
                startActivity(intent);
            }
        });
        tv_balance.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(AllApplicationActivity.this, BalanceActivity.class);
                startActivity(intent);
            }
        });
        tv_bookkeeping.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(AllApplicationActivity.this, BookkingActivity.class);
                startActivity(intent);
            }
        });
    }
}